package cn.crism.chatme.controller;

import cn.crism.chatme.enums.SearchFriendsStatusEnum;
import cn.crism.chatme.pojo.ChatMsg;
import cn.crism.chatme.service.ChatMsgService;
import cn.crism.chatme.utils.JSONResult;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @CreateDate: 2018/12/24 8:25 PM
 * @Description:
 * @Author: Crism
 */

@RestController
@RequestMapping("msg")
public class ChatMsgController {

    @Autowired
    private ChatMsgService chatMsgService;

    @PostMapping("/getUnReadMsgList")
    public JSONResult getUnReadMsgList(@RequestParam("myUserId") String myUserId){

        if (StringUtils.isBlank(myUserId)){
            return JSONResult.errorMsg("参数不能为空！");
        }
        List<ChatMsg> chatMsgList = chatMsgService.getUnReadMsgList(myUserId);
        return JSONResult.ok(chatMsgList);
    }

}
